package com.xpchenfrank.controller;

import com.xpchenfrank.controller.TestBusinessImpl;
import com.xpchenfrank.service.BlogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 用于测试线程的
 *
 * @author xpchen
 * @time 2019/1/16
 * @Description
 * @copyright Wuxi Yazuo ,Ltd.copyright 2015-2025
 */
@Slf4j
@RestController
@RequestMapping("thread")
public class ThreadTestController {

    private String username;
    private String password;

    @GetMapping("/say")
    public String hello(String username, String password) throws InterruptedException {
        this.username = username;
        this.password = password;
        Thread.sleep(1000);
//        System.out.println(this.username);
//        System.out.println(this.password);
        System.out.println("Thread name is " + Thread.currentThread().getName() + " " + this.username + this.password);
        return "hello world!";
    }

    @ResponseBody
    @RequestMapping(value = "/normal", method = RequestMethod.GET)
    public String normal() {
        return "我就是个正常的接口，我不调用任何东西";
    }

}
